<?php /* Smarty version 2.6.25, created on 2014-02-20 10:07:51
         compiled from question/views/admin.new-question.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'count', 'question/views/admin.new-question.tpl', 216, false),)), $this); ?>
<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/ckeditor/ckeditor.js"></script> 
<script type="text/javascript" src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/ckfinder/ckfinder.js"></script>  
<link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery-ui/js/jquery-ui.js"></script>
<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.slug.js"></script>
 <!-- Bootstrap -->
	
    <script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/jquery.tmpl.min.js"></script>
  
    <script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/bootstrap.file-input.js"></script>
	<script src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/init.js"></script>
	
	    <link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/bootstrap.css" rel="stylesheet" media="screen">
    <link href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/style2.css" rel="stylesheet" />
    <!--                       CSS                       -->

    <link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/reset.css"  type="text/css"  />
  
    <link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/style.css" type="text/css" />
    
    <link rel="stylesheet" href="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/css/invalid.css"  type="text/css" /> 
<style>
h1, h2, h3 {
    line-height: 30px;
}
li {
    line-height: 12px;
}
.ui-autocomplete {
        max-height: 200px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
        /* add padding to account for vertical scrollbar */
        padding-right: 20px;
    }
    /* IE 6 doesn't support max-height
     * we use height instead, but this forces the menu to always be this tall
     */
    * html .ui-autocomplete {
        height: 100px;
    }
    
</style>
    
<script id="choiceTemplate" type="text/x-jquery-tmpl">
       <li>
            <div class="control-group">
                <label class="control-label" for="inputChoice1" style="min-width:50px;padding-left:140px;">
                    <input type="checkbox" class="checkAns_${lang}" onclick="countCheck()" name="data2[${lang}][check][]" value="b"></label>
                <div class="controls">
                    <div class="input-prepend input-append">
                        <span class="add-on">${c}</span>
                        <input class="span3" name="data2[${lang}][answer][]" id="Text2" type="text">
                        <button class="btn btnRemoveChoice"><i class="icon-remove"></i></button>
                    </div>
                </div>
            </div>
        </li>
    </script>
<script type="text/javascript">

function countCheck(lang_id)
{
		
	var x = [];
	$('.checkAns_' + lang_id).each(function(){
		if($(this).is(":checked"))
		{
			x.push(1);
		}
		else x.push(0);
	});
	$('input#checkboxAns_' + lang_id).val(x);
}

function submitQuestion()
{
	countCheck(1);
	countCheck(2);
	$('#submitFormQuestion').submit();
	
}
function split( val ) {
    return val.split( /,\s*/ );
}
function extractLast( term ) {
    return split( term ).pop();
}

function addInput()
{
     var value = $(".ui-corner-right ui-button-icon").val();
     
     jQuery.ajax({
         url: '<?php echo $this->_tpl_vars['APP_BASE_URL']; ?>
product/admin/add-input',
       type: "POST",
       data: {'value':value},
         beforeSend: function( xhr ) {
         },
         success: function( data ) {
        //Do anything
          //  alert(data);
             appendOptionLast(data,value);
         }
      });
}

    //<![CDATA[

    jQuery(document).ready(function (){

        
        CKFinder.setupCKEditor( null, '<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/js/ckfinder/' );
        jQuery( "#images" ).sortable();
        jQuery( "#images" ).disableSelection();
        //Datepicker
        jQuery( ".date" ).datepicker({
            showAnim        : 'slideDown',
            showButtonPanel : true,
            dateFormat      : '<?php echo $this->_tpl_vars['datepickerFormat']['js']; ?>
'
        });

        //Make slug
        <?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langDiv'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langDiv']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['langDiv']['iteration']++;
?>
        jQuery('#title').makeSlug({
            slug: jQuery('#alias')
        });
        <?php endforeach; endif; unset($_from); ?>
       	 
 	                         
 	        $( "#unit" )
 	            // don't navigate away from the field on tab when selecting an item
 	            .bind( "keydown", function( event ) {
 	                if ( event.keyCode === $.ui.keyCode.TAB &&
 	                        $( this ).data( "autocomplete" ).menu.active ) {
 	                    event.preventDefault();
 	                }
 	            })
 	            .autocomplete({
 	                minLength: 0,
 	                source: function( request, response ) {
 	                    // delegate back to autocomplete, but extract the last term
 	                    response( $.ui.autocomplete.filter(
 	                            availableUnit, extractLast( request.term ) ) );
 	                },
 	                focus: function() {
 	                    // prevent value inserted on focus
 	                    return false;
 	                },
 	                
 	            });   

  	       var availableUnit = new Array();
  	       
  	      <?php $_from = $this->_tpl_vars['allUnits']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['item']):
?>
  	      availableUnit[<?php echo $this->_tpl_vars['k']; ?>
] = "<?php echo $this->_tpl_vars['item']['name']; ?>
";
  	       <?php endforeach; endif; unset($_from); ?> 

  	  	    	
        
    });
    
    function showMenu() {
        $("#unit").autocomplete( "search" , '' );
    }
    function appendOptionLast(num,value)
    {
      var elOptNew = document.createElement('option');
      elOptNew.text =  value;
      elOptNew.value =  num;
      var elSel = document.getElementById('combobox');

      try {
        elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
      }
      catch(ex) {
        elSel.add(elOptNew); // IE only
      }
    }
//]]>
</script>
<style type="text/css">
    #images { list-style-type: none; margin: 0; padding: 0;}
    #images li { margin: 10px; float: left; text-align: center;  height: 180px;}
</style>


       
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    
                    <h3>New Question</h3>
                    
                    <ul class="content-box-tabs">
                        <?php if ($this->_tpl_vars['fullPermisison']): ?><li><a href="#tab0" class="default-tab">General</a></li><?php endif; ?>
                        <?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langTab'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langTab']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['langTab']['iteration']++;
?>
                        <li><a <?php if (! $this->_tpl_vars['fullPermisison'] && ($this->_foreach['langTab']['iteration'] <= 1)): ?>class="default-tab"<?php endif; ?> href="#tab<?php echo $this->_tpl_vars['item']['lang_id']; ?>
" style="padding-bottom: 4px;">
                        <image style="vertical-align:middle;" src="<?php echo $this->_tpl_vars['BASE_URL']; ?>
<?php echo $this->_tpl_vars['item']['lang_image']; ?>
"> <?php echo $this->_tpl_vars['item']['name']; ?>
</a></li>
                        <?php endforeach; endif; unset($_from); ?>
                    </ul>
                    
                    <div class="clear"></div>
                    
                </div> <!-- End .content-box-header -->
                
                <div class="content-box-content">
                
                    <form id="submitFormQuestion" action="" method="post">
                    
                    <!-- GENERAL -->
                    <div class="tab-content <?php if (! $this->_tpl_vars['fullPermisison']): ?>hidden<?php endif; ?>" id="tab0">
                    
                        <!-- ERROR -->
                        <?php if (count($this->_tpl_vars['errors']) > 0): ?>
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="<?php echo $this->_tpl_vars['LAYOUT_HELPER_URL']; ?>
admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                <?php if ($this->_tpl_vars['errors']['main']): ?>
                                    Error: <?php echo $this->_tpl_vars['errors']['main']; ?>

                                <?php else: ?>
                                    Error: Please check following information again
                                <?php endif; ?> 
                                                                       
                            </div>
                        </div>
                        <?php endif; ?>
                            
                            <fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                                <p>
                                    <label>Category<span class="red">*</span></label>              
                                    <select name="data[content_category_gid]" class="small-input">
                                    <?php $_from = $this->_tpl_vars['allCats']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                                        <option value="<?php echo $this->_tpl_vars['item']['content_category_gid']; ?>
" <?php if ($this->_tpl_vars['data']['content_category_gid'] == $this->_tpl_vars['item']['content_category_gid']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['item']['name']; ?>
</option>
                                    <?php endforeach; endif; unset($_from); ?>
                                    </select> 
                                </p>
                                <p>
                                    <label>Published<span class="red">*</span></label>
                                    <input type="radio" name="data[genabled]" value="1" <?php if ($this->_tpl_vars['data']['genabled'] != '0'): ?>checked="checked"<?php endif; ?>/> Yes &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="radio" name="data[genabled]" value="0" <?php if ($this->_tpl_vars['data']['genabled'] == '0'): ?>checked="checked"<?php endif; ?>/> No
                                </p>
                                <p>
                                    <label>Sorting<span class="red">*</span><br/><br/></label>
                                        <input class="text-input small-input" type="text"  name="data[sorting]" value="<?php echo $this->_tpl_vars['data']['sorting']; ?>
" /><?php if ($this->_tpl_vars['errors']['repeat_password']): ?><span class="input-notification error png_bg"></span><?php endif; ?>
                                        <br /><small>No 1 will display as first article</small>
                                </p>
                                <p>
                                    <label>Type<span class="red">*</span></label>
                                    <input type="radio" name="data[type]" value="1" <?php if ($this->_tpl_vars['data']['enabled'] != '0'): ?>checked="checked"<?php endif; ?>/> Lecture &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="radio" name="data[type]" value="0" <?php if ($this->_tpl_vars['data']['enabled'] == '0'): ?>checked="checked"<?php endif; ?>/> Exercise
                                </p>
                                
                               
                                
                                    <br/>
                                  <div>
                                    <label>Level</label>
                                   
                                    
                                    <div class="ui-widget" style="width: 180px;float: left ;height: 30px;">
                                 
                                        <input class="small-input"  style="width:100px;" id="unit" name="data[level]" value="<?php echo $this->_tpl_vars['data']['level']; ?>
"> 
                                        <button aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right ui-button-icon" title="Show All Items" tabindex="-1" style="margin-left:-10px;" onclick="showMenu();" type="button"><span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"></span><span class="ui-button-text">&nbsp;</span></button>
                                        
                                     </div>
                                </div>
                                <br/>
                                
                               
                                
                               
                                          
                                
                            
                                
                              
                                
                                <p>
                                <br/>
                                    <input class="button submit" type="button" value="Save" />
                                </p>
                                
                            </fieldset>
                            
                            
                            <div class="clear"></div><!-- End .clear -->
                            
                    </div>  <!-- End GENERAL --> 
                    
                    <?php $_from = $this->_tpl_vars['allLangs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['langDiv'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['langDiv']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['langDiv']['iteration']++;
?>
                    <!-- LANGUAGES -->
                    <div class="tab-content <?php if ($this->_tpl_vars['fullPermisison'] || ! ($this->_foreach['langDiv']['iteration'] <= 1)): ?>hidden<?php endif; ?>" id="tab<?php echo $this->_tpl_vars['item']['lang_id']; ?>
">
                    
                            <fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                                <p>
                                    <label>Published</label>
                                    <input type="radio" name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][enabled]" value="1" <?php if ($this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['enabled'] == '1'): ?>checked="checked"<?php endif; ?>/> Yes &nbsp;&nbsp;&nbsp;&nbsp;
                                    <input type="radio" name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][enabled]" value="0" <?php if ($this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['enabled'] != '1'): ?>checked="checked"<?php endif; ?>/> No
                                </p>
                                <p>
                                    <label>Title</label>
                                        <input id="title<?php echo $this->_foreach['langDiv']['iteration']; ?>
" class="text-input large-input" type="text"  name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][title]" value="<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['title']; ?>
" />
                                </p>
                                        <input id="alias<?php echo $this->_foreach['langDiv']['iteration']; ?>
" style="width: 675px;display:none" class="text-input small-input" type="text"  name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][alias]" value="<?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['alias']; ?>
" /> 
                                
                                    <div><textarea style="float:left;" class="text-input textarea ckeditor"  name="data[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][full_text]" rows="20" cols="90"><?php echo $this->_tpl_vars['data'][$this->_tpl_vars['item']['lang_id']]['full_text']; ?>
</textarea></div>
                                  <div class="row" style="padding-left:20px;">
                            <fieldset>
                                
                                <div class="toggleContent">
                                    
                                    <h5>Answers:</h5>
                                    <ul class="multichoice_<?php echo $this->_tpl_vars['item']['lang_id']; ?>
 nav">
                                        <li>             
										<div class="control-group"> 
										<label style="min-width:50px;padding-left:140px;" for="inputChoice1" class="control-label"> 
										<input type="checkbox" class="checkAns_<?php echo $this->_tpl_vars['item']['lang_id']; ?>
" onclick="countCheck(<?php echo $this->_tpl_vars['item']['lang_id']; ?>
)" name="data2[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][check][]" value="a"></label> 
										<div class="controls"> 
										<div class="input-prepend input-append">
										<span class="add-on">A</span> 
										<input type="text" id="Text2" name="data2[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][answer][]" class="span3">
										<button class="btn btnRemoveChoice"><i class="icon-remove"></i></button>                     </div>                 </div>             </div>         </li>
                                        <li>
                                            <div class="control-group">
                                                <label class="control-label" for="inputChoice1" style="min-width:50px;padding-left:140px;">
                                                                                        <input type="checkbox" class="checkAns_<?php echo $this->_tpl_vars['item']['lang_id']; ?>
" onclick="countCheck(<?php echo $this->_tpl_vars['item']['lang_id']; ?>
)" name="data2[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][check][]" value="b"></label></label>
                                                <div class="controls">
                                                    <div class="input-prepend input-append">
                                                        <span class="add-on">B</span>
                                                        <input class="span3" name="data2[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][answer][]" id="inputChoice" type="text">
                                                        <button class="btn btnAddChoice" value="<?php echo $this->_tpl_vars['item']['lang_id']; ?>
"><i class="icon-plus"></i></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </li>
                                    </ul>
                                    
                                </div>

                            </fieldset>
                        </div>

                                <input type="hidden" name="data2[<?php echo $this->_tpl_vars['item']['lang_id']; ?>
][checkAns]" id="checkboxAns_<?php echo $this->_tpl_vars['item']['lang_id']; ?>
" />   
                                <p>
                                <br/>
                                    <input class="button submit" type="button" value="Save" />
                                </p>
                                
                            </fieldset>
                            
                            <div class="clear"></div><!-- End .clear -->
                            
                    </div>
                                
                        
                    <?php endforeach; endif; unset($_from); ?>
                    
                  </form>
                  
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
            
            
            <div class="clear"></div>
